#ifndef _GDU_DEFINE_H_
#define _GDU_DEFINE_H_

#define DEBUG_RESPONSE_MODE 1

#define BOOT_SIDE_ORG 0
#define BOOT_SIDE_BAK 1

#define BAKMODE_FLASH_FILE "/gpsclock/BAKMODE"
#define BAKMODE_RAM_FILE "/etc/BAKMODE"

#define FWUPD_ORG_PATH "/gpsclock/ORG/"
#define FWUPD_BAK_PATH "/gpsclock/BAK/"
#define FWUPD_IMG_PATH "IMG/"
#define FWUPD_BAK_DIFF_PATH "/gpsclock/BAK"
#define FWUPD_TAG_PATH "TAG/"
#define FWUPD_TAG_PATH_NAME "TAG"

#define DEBUG_LOCAL_A_IPADDR "118.220.36.153"
#define DEBUG_LOCAL_B_IPADDR "118.220.36.156"
#define DEBUG_SIDE_A_IPADDR "192.168.10.19"
#define DEBUG_SIDE_B_IPADDR "192.168.10.20"
#define FWUPD_TFTP_PATH "/tmp/"

#define FWUPD_ZIPED_FILE_NAME "grcafw.gz"
#define FWUPD_UNZIPED_FILE_NAME "grcafw"
#define FWUPD_BACKEDUP_FILE_NAME "grcaimg.gz"

#define FWUPD_HEADER_FILE_NAME "headerfile"
#define FWUPD_TAIL_FILE_NAME "grcafw.tar"
#define FWUPD_TAG_FILE_NAME "tagfile"


#define ECHO_SYNC_START_OK_MSG "sync ready"
#define ECHO_UNZIP_TAR_OK_MSG "unzip tar ready"
#define ECHO_TAILFILE_OK_MSG "tailfile ready"
#define ECHO_HEADFILE_OK_MSG "headfile ready"
#define ECHO_GUNZIP_OK_MSG "unzip gz ready"
#define ECHO_BACKUP_OK_MSG "backup gz ready"


#define FWUPD_START_TIMEOUT 0
//#define FWUPD_GUNZIP_TIMEOUT 20
#define FWUPD_GUNZIP_TIMEOUT 30
#define FWUPD_TFTP_TIMEOUT 30
#define FWUPD_TAR_TIMEOUT 10
#define FWUPD_HEAD_TIMEOUT 10
#define FWUPD_TAIL_TIMEOUT 10
#define FWUPD_TAG_TIMEOUT 5
#define FWUPD_SYNC_TIMEOUT 10
#define FWUPD_DIFF_BEFORE_TIMEOUT 2
#define FWUPD_DIFF_AFTER_TIMEOUT 10
#define FWUPD_BACKUP_TIMEOUT 10

#define FWUPD_UBOOT_HEADER_SIZE 64
#define FWUPD_NORTEL_TAG_SIZE 296


#define TAG_FILES_ALL_OK 0
#define TAG_FILES_ORG_NOK 1
#define TAG_FILES_BAK_NOK 2
#define TAG_FILES_ALL_NOK 3

#ifndef OK
#define OK 1
#endif

#ifndef FAIL
#define FAIL 0
#endif

#ifndef WIN_APP
#ifdef __GNUC__
	#define PACKED __attribute__ ((__packed__))
#else
	#define PACKED
	#pragma pack(1)
#endif
#endif

extern int debug_out_udp;
#define udp_printf(...)							\
{												\
	if(debug_out_udp){							\
		printf(__VA_ARGS__);					\
	}											\
}



/* grca.h */
#define BOARD_SIDE_UNKNOWN										0
#define BOARD_SIDE_A											1
#define BOARD_SIDE_B											2


#endif
